package Widget

import (
	"github.com/lxn/walk/declarative"
)

type WidgetButton struct {
	Sprite *declarative.PushButton
	Button *declarative.PushButton
}

func (w *WidgetButton) SetButtonText(txt string) {
	if w.Button == nil {
		return
	}
	w.Button.Text = txt
}

func (w *WidgetButton) SetButtonFunc(cb func()) {
	if w.Button == nil {
		return
	}
	w.Button.OnClicked = cb
}

func CreateWidgetButton() *WidgetButton {
	b := &declarative.PushButton{
		Text:    "测试按钮",
		MaxSize: declarative.Size{Width: 50, Height: 40},
		//OnClicked: cb,
	}
	wb := &WidgetButton{
		Sprite: b,
	}
	return wb
}
